window.Model = function (options) {
  // Model 就是模板
  let resourceName = options.resourceName;
  return {
    init: function () {
      AV.init({
        appId: "6QEhBTOEUrHYTwQvuKyrn0rT-gzGzoHsz",
        appKey: "BmT8ng5MmIRlQvDltuvys8Ro",
        serverURL: "https://6qehbtoe.lc-cn-n1-shared.com",
      });
    },
    fetch: function () {
      let query = new AV.Query(resourceName);
      return query.find(); // Promise 对象
    },
    save: function (object) {
      let X = AV.Object.extend(resourceName); //连接对应数据库名字
      let x = new X();
      return x.save(object);
    },
  };
};
